/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package tcc.ejb.controleProjeto.entidade;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Maciel
 */
@Entity
@Table(name = "diario", catalog = "macielqs", schema = "controleprojeto")
@NamedQueries({
    @NamedQuery(name = "Diario.findAll", query = "SELECT d FROM Diario d"),
    @NamedQuery(name = "Diario.findById", query = "SELECT d FROM Diario d WHERE d.id = :id"),
    @NamedQuery(name = "Diario.findByData", query = "SELECT d FROM Diario d WHERE d.data = :data"),
    @NamedQuery(name = "Diario.findByProfissionalId", query = "SELECT d FROM Diario d WHERE d.profissionalId = :profissionalId")})
public class Diario implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "id", nullable = false)
    private Integer id;
    @Basic(optional = false)
    @Column(name = "data", nullable = false)
    @Temporal(TemporalType.DATE)
    private Date data;
    @Basic(optional = false)
    @Column(name = "profissional_id", nullable = false)
    private int profissionalId;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "diario")
    private List<Evento> eventoList;
    @JoinColumn(name = "release_id", referencedColumnName = "id", nullable = false)
    @ManyToOne(optional = false)
    private Release release;

    public Diario() {
    }

    public Diario(Integer id) {
        this.id = id;
    }

    public Diario(Integer id, Date data, int profissionalId) {
        this.id = id;
        this.data = data;
        this.profissionalId = profissionalId;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    public int getProfissionalId() {
        return profissionalId;
    }

    public void setProfissionalId(int profissionalId) {
        this.profissionalId = profissionalId;
    }

    public List<Evento> getEventoList() {
        return eventoList;
    }

    public void setEventoList(List<Evento> eventoList) {
        this.eventoList = eventoList;
    }

    public Release getRelease() {
        return release;
    }

    public void setRelease(Release release) {
        this.release = release;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Diario)) {
            return false;
        }
        Diario other = (Diario) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "tcc.ejb.controleProjeto.entidade.Diario[id=" + id + "]";
    }

}
